//
//  SecondCollectionViewCell.m
//  土巴兔
//
//  Created by 千锋 on 16/1/4.
//  Copyright (c) 2016年 IOS1503薛凯. All rights reserved.
//

#import "SecondCollectionViewCell.h"
#import "Default.h"
#import "UIImageView+WebCache.h"
@implementation SecondCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
       
        [self creatUI];
    }
    return self;
}
- (void)creatUI{
    _imageview=[[UIImageView alloc] initWithFrame:self.contentView.bounds];
    [self.contentView addSubview:_imageview];
}
- (void)relayoutWithModel:(SecondModel*)model
{//       CGFloat weidth=(DEVICEWIDTH-30)/2;
//        CGFloat height=([model.height floatValue]*weidth)/[model.width  floatValue];
//    //    cell.bounds=CGRectMake(0, 0, weidth, height);
//    self.frame=CGRectMake(self.frame.origin.x, self.frame.origin.y, weidth, height);
    CGFloat height=([model.height floatValue]*(DEVICEWIDTH-10)/2)/[model.width  floatValue];
    _imageview.frame=CGRectMake(0, 0, (DEVICEWIDTH-10)/2, height);
    [_imageview sd_setImageWithURL:[NSURL URLWithString:model.filename]];
    
}
@end
